package cn.edu.nwafu.hjpg.service.impl;


import cn.edu.nwafu.hjpg.dao.HyxxbDao;
import cn.edu.nwafu.hjpg.entity.Hjxwb;
import cn.edu.nwafu.hjpg.entity.Hyxxb;
import cn.edu.nwafu.hjpg.service.HyxxbService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HyxxbServiceImpl implements HyxxbService {
    final HyxxbDao hyxxbDao;


    public HyxxbServiceImpl(HyxxbDao hyxxbDao) {
        this.hyxxbDao = hyxxbDao;
    }


    @Override
    public Page<?> findAddRecordHyxxb(String flag, Pageable pageable) {
        return hyxxbDao.findAllByflag(flag,pageable);
    }

    @Override
    public String addupdateFlag(Hyxxb hyxxb) {
        return hyxxbDao.save(hyxxb).getId();
    }

    @Override
    public void deladdRecordhyxxb(Hyxxb hyxxb) {
    hyxxbDao.delete(hyxxb);
    }

    @Override
    public String updatehyxxb(Hyxxb hyxxb) {
        return hyxxbDao.save(hyxxb).getId();
    }

    @Override
    public String addZyytms(Hyxxb hyxxb) {
        return hyxxbDao.insert(hyxxb).getId();
    }

    @Override
    public String addHyscl(Hyxxb hyxxb) {
        return hyxxbDao.insert(hyxxb).getId();
    }

    @Override
    public String addHysyl(Hyxxb hyxxb) {
        return hyxxbDao.insert(hyxxb).getId();
    }

    @Override
    public String addHygndg(Hyxxb hyxxb) {
        return hyxxbDao.insert(hyxxb).getId();
    }

    @Override
    public String addHyyyly(Hyxxb hyxxb) {
        return hyxxbDao.insert(hyxxb).getId();
    }

    @Override
    public String addHyscgyms(Hyxxb hyxxb) {
        return hyxxbDao.insert(hyxxb).getId();
    }

    @Override
    public String addHysygyms(Hyxxb hyxxb) {
        return hyxxbDao.insert(hyxxb).getId();
    }

    @Override
    public String addScsybz(Hyxxb hyxxb) {
        return hyxxbDao.insert(hyxxb).getId();
    }

    @Override
    public String addPfxsdq(Hyxxb hyxxb) {
        return hyxxbDao.insert(hyxxb).getId();
    }

    @Override
    public String addPfxss(Hyxxb hyxxb) {
        return hyxxbDao.insert(hyxxb).getId();
    }

    @Override
    public List<Hyxxb> findByIdAndFlagInHyxxb(String id, String name, String flag) {
        return hyxxbDao.findElementByBaseinfoWzbmAndAttributeAndFlag(id,name,flag);
    }
    @Override
    public String addElement(Hyxxb hyxxb) {
        return hyxxbDao.insert(hyxxb).getBaseinfoWzbm();
    }

    @Override
    public List<Hyxxb> findAllByBaseinfoWzbmAndFlag(String id, String flag) {
        return  hyxxbDao.findAllByBaseinfoWzbmAndFlag(id,flag);
    }

    @Override
    public Page<?> findByPageHyxxb(String id,String attribute, int flag, Pageable pageable) {
        return hyxxbDao.findAllByflagAndAttribute(id,attribute,flag,pageable);
    }



    @Override
    public List<Hyxxb> findAll() {
        return hyxxbDao.findAll();
    }
}

